package com.fhz.day006;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

/**
 * 时间:2022/5/24
 *
 * @author msfeng
 * 简述: TODO
 */
@Dao
public interface UserDao {
    @Insert
    void insert(User user); //insert into user set name = user.name

    @Update
    void update(User user); //10

    @Delete
    void delete(User user); //20

    @Query("select * from user where uid = :uid")
    User findUserById(int uid);

    @Query("select * from user where username like :ha")
    List<User> findAll(String ha);

    @Query("select * from user")
    LiveData<List<User>> getAllUserByLiveData();


}

